← Back
Editing: index201.js
import{v as a,af as e,hu as t,c as s,k as l}from"./utils-lib.js?v=1765440387";import{c as r,r as n,k as i,aC as o,p as u,q as p,v as m,y as c,e as d,A as y,F as b,a$ as g,x as f,M as v,P as h,B as _,C as k,bm as x,aj as j,ak as w,ai as C,ag as P}from"./base-lib.js?v=1765440387";import{bq as O,br as D,bs as V,bt as q}from"./site.js?v=1765440387";import{f as I}from"./useController5.js?v=1765440387";import"./__commonjsHelpers__.js?v=1765440387";import"./column.js?v=1765440387";import"./index94.js?v=1765440387";import"./useStore3.js?v=1765440387";import"./useController6.js?v=1765440387";import"./validator.js?v=1765440387";const S={class:"p-[2rem]"},A={class:"flex items-center justify-between mb-[8px]"},E={key:1},N=r({__name:"index",props:{compData:{default:()=>({})}},setup(r){var N,$;const B=r,{proxy:H}=x(),J=n("PHPMOD"===(null==($=null==(N=B.compData)?void 0:N.project_config)?void 0:$.type)),M=n(),Q=n("today"),T=i([{label:"IP地址",prop:"ip",render:a=>o("span",{class:a.deny_status?"line-through text-[#bbb] cursor-pointer":"text-[#20a53a] cursor-pointer",on:{click:async()=>{try{await H.$confirm({title:"IP地址",message:"确定要".concat(a.deny_status?"解封":"封禁","当前ip吗?"),icon:"warning"});let e=null;if(a.deny_status)e=await D({data:JSON.stringify({address:a.ip})});else{let t={choose:"address",address:a.ip,domain:"",types:"drop",brief:"网站流量点击IP手动封禁"};e=await O({data:JSON.stringify(t)})}H.$message.request(e),X()}catch(e){}}}},a.ip)},{label:"归属地",render:a=>o("div",{class:"flex",style:{gap:"4px"}},[o("span",a.country),o("span",a.province),o("span",a.city)])},{label:"造成流量",prop:"flow",render:e=>o("span",a(e.flow))}]),U=n([{title:"今天",key:"today"},{title:"昨天",key:"yesterday"},{title:"近7天",key:"l7"},{title:"近30天",key:"l30"},{title:"近1小时",key:"h1"}]),F=n([]),L=n("流量趋势"),{BtECharts:z,getEChart:G,setOption:K,setQuickOption:R}=e({options:{xAxis:{type:"category",data:[]},yAxis:{type:"value",name:"单位:字节",axisLabel:{margin:2,formatter:function(a,e){return a>=1e4&&a<1e7?a=a/1e4+"万":a>=1e7&&(a=a/1e7+"千万"),a}}},grid:{show:!1,bottom:"20%",right:"5%"},series:[{data:[],type:"line"}]}}),W=async()=>{let a=[],e=[0,0,0,0,0,0,0],t=!1;try{const s=await q({site_name:B.compData.name,query_date:Q.value});s&&(e=[]),s.forEach(s=>{"h1"!=Q.value&&"today"!=Q.value&&"yesterday"!=Q.value||(t=!0),a.push(ea(String(s.time),t)),e.push(s.flow)})}catch(s){}R(a,e)},X=async()=>{try{const a=await V({site_name:B.compData.name,query_date:Q.value});F.value=a}catch(a){}},Y=a=>{L.value=a,"流量趋势"===a?W():X()},Z=a=>{Q.value=a,"流量趋势"===L.value?W():X()},aa=()=>{I({...B.compData,tabName:"flowQuota"},"limit")},ea=(a,e)=>{let t="";return e?(t=a.substring(8,10)+":"+(12===a.length?a.substring(10,12):"00"),t):(12===a.length||10===a.length?t=a.substring(0,4)+"-"+a.substring(4,6)+"-"+a.substring(6,8)+" "+a.substring(8,10)+":"+(12===a.length?a.substring(10,12):"00"):8===a.length&&(t=a.substring(0,4)+"-"+a.substring(4,6)+"-"+a.substring(6,8)),t)};return u(()=>{W()}),(a,e)=>{const r=j,n=w,i=C,o=P,u=s,x=l;return p(),m("div",S,[c("div",A,[d(n,{modelValue:f(Q),"onUpdate:modelValue":e[0]||(e[0]=a=>h(Q)?Q.value=a:null),onChange:Z,class:"!w-[10rem]"},{default:y(()=>[(p(!0),m(b,null,g(f(U),(a,e)=>(p(),v(r,{key:e,label:a.title,value:a.key},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),d(o,{modelValue:f(L),"onUpdate:modelValue":e[1]||(e[1]=a=>h(L)?L.value=a:null),onChange:Y},{default:y(()=>[d(i,{label:"流量趋势"}),d(i,{label:"IP TOP 10"})]),_:1},8,["modelValue"]),f(t)||f(J)?k("",!0):(p(),v(u,{key:0,onClick:aa},{default:y(()=>[...e[2]||(e[2]=[_("流量限额>>",-1)])]),_:1}))]),c("div",null,["流量趋势"===f(L)?(p(),v(f(z),{key:0,ref_key:"totalCharts",ref:M,class:"h-[32rem]"},null,512)):k("",!0),"IP TOP 10"===f(L)?(p(),m("div",E,[d(x,{column:f(T),data:f(F)},null,8,["column","data"])])):k("",!0)])])}}});export{N as default};
Save File
Cancel